package com.zenith.storage.enums;

import lombok.Getter;

/**
 * 存储提供商枚举
 */
@Getter
public enum StorageProviderEnum {
    /**
     * 阿里云OSS
     */
    ALIYUN_OSS("aliyun-oss", "阿里云OSS"),
    
    /**
     * 腾讯云COS
     */
    TENCENT_COS("tencent-cos", "腾讯云COS"),
    
    /**
     * 本地MinIO
     */
    MINIO_LOCAL("minio-local", "本地MinIO"),
    
    /**
     * AWS S3
     */
    AWS_S3("aws-s3", "AWS S3");
    
    private final String code;
    private final String name;
    
    StorageProviderEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
    
    /**
     * 根据代码获取枚举
     * @param code 代码
     * @return 枚举
     */
    public static StorageProviderEnum fromCode(String code) {
        for (StorageProviderEnum provider : values()) {
            if (provider.getCode().equals(code)) {
                return provider;
            }
        }
        return null;
    }
}